package il.ac.tau.cvws.scrabblesidekick.client.ui;

import il.ac.tau.cvws.scrabblesidekick.client.R;
import il.ac.tau.cvws.scrabblesidekick.client.app.controller.MainController;
import il.ac.tau.cvws.scrabblesidekick.client.app.controller.ScrabbleSidekickController;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/* Main activity. The user has the option to either calibrate the application
 * or analyze a move if the application is already calibrated.
 */
public class MainActivity extends ScrabbleSidekickActivity 
{
	private MainController _mController;
	
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        
        _mController = (MainController)_controller;
        
        setContentView(R.layout.activity_main);
        
        Button startGameBtn = (Button)findViewById(R.id.start_btn);
        startGameBtn.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				_mController.startGame(v.getContext());
			}
		});
        
        Button calibrateBtn = (Button)findViewById(R.id.calibrate_btn);
        calibrateBtn.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				_mController.startCalibration(v.getContext());
			}
		});
    }
    
	@Override
	protected ScrabbleSidekickController createController()
	{
		return new MainController(this);
	}
}
